package com.yiren.manager.ctrl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.yiren.core.exception.MyException;
import com.yiren.core.repository.utils.QueryResult;
import com.yiren.core.utils.HTTPResult;
import com.yiren.entity.YrElderBeHospital;
import com.yiren.manager.service.iface.elder.YrElderBeHospitalService;

@RestController
@RequestMapping("test")
public class TestController{
	
	@Autowired
	private YrElderBeHospitalService elderBeHospitalService ;

	@RequestMapping("findBeHosipital")
	@ResponseBody
	private HTTPResult<YrElderBeHospital> findBeHosipital() throws MyException{
		HTTPResult<YrElderBeHospital> result = new HTTPResult<YrElderBeHospital>();
		
		String sqlWhere = "be_status<>2";
		QueryResult<YrElderBeHospital> qrElderBeHospital = elderBeHospitalService.find(YrElderBeHospital.class,
				sqlWhere, new Object[] {});
		List<YrElderBeHospital> elderBeHospitalList = qrElderBeHospital.getResultList();
		System.out.println(elderBeHospitalList.size());
		for(YrElderBeHospital elderBeHospital : elderBeHospitalList){
			System.out.println(elderBeHospital.getElderId());
		}
		
		result.setData(elderBeHospitalList);
		
		return result;

	}
}
